<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MVCWeb.Models.Ads>>" %>

<%@ Register Src="~/Views/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="mmuc" %>
<%@ Register Src="~/Views/Shared/LogOnUserControl.ascx" TagName="LogOnUserControl" TagPrefix="louc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title>Index of Ads</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script language="javascript" type="text/javascript">
        function deleteRecord(recordId) {
            if (confirm("Are you sure to delete this ads?")) {
                // Perform delete
                var action = '<%= Url.Action("Delete", "Ads") %>/' + recordId;
                var request = new Sys.Net.WebRequest();
                request.set_httpVerb("POST");
                request.set_url(action);
                request.add_completed(deleteCompleted);
                request.invoke();
            }
        }

        function deleteCompleted() {
            // Reload page  
            window.location.reload();
        }    
    </script>

    <louc:LogOnUserControl ID="LogOnUserControl1" runat="server" />
     <!-- BEGIN: MainMenu -->    
    <mmuc:MainMenu ID="MainMenu1" runat="server" />
    <!-- END: MainMenu -->
    <br />
    <table cellpadding="4" cellspacing="1" border="0" width="100%" class="DataTable">
        <tr>
            <th>
                AdsId
            </th>
            <th>
                Type
            </th>
            <th>
                Description
            </th>
            <th>
                Contribution Amt
            </th>
            <th>
                Contribution Type
            </th>
            <th>
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%= Html.Encode(item.AdsId) %>
            </td>
            <td>
                <%= Html.Encode(item.Type) %>
            </td>
            <td>
                <%= Html.Encode(item.Description) %>
            </td>
            <td>
                <%= Html.Encode(String.Format("{0:F}", item.ContributionAmt)) %>
            </td>
            <td>
                <%= Html.Encode(item.ContributionType) %>
            </td>
            <td style="white-space: nowrap">
                <%= Html.ActionLink("Edit", "Edit", new {id = item.AdsId})%>
                | <a onclick="deleteRecord(<%= item.AdsId %>)" href="JavaScript:void(0)">Delete</a>
            </td>
        </tr>
        <% } %>
    </table>
    <p>
        <%= Html.ActionLink("Create New", "Create") %>
    </p>
</asp:Content>
